package com.vip.jwt;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.socket.config.annotation.EnableWebSocket;

import javax.annotation.PostConstruct;

@SpringBootApplication
//@EnableScheduling //开启定时任务
//@EnableWebSocket
public class JwtApplication extends SpringBootServletInitializer {

    // 打war包配置
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(JwtApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(JwtApplication.class, args);
    }

    /**
     * 启动初始化
     */
    @PostConstruct
    public void init(){
        //todo 初始化执行
    }

    /**
     * 在指定时间执行  0-59(秒)  0-59(分)  0-11(时)  *(每天)
     */
    @Scheduled(cron = "0 0 22 ? * *")
    public void fixTimeExecution() {
        System.out.println("在指定时间执行");
    }

}
